// uniapp中不支持原生axios库

// 封装 HTTP 请求方法
export const baseUrl = 'http://47.113.202.69:9090/gbg';
// export const baseUrl = 'http://localhost:9090/gbg';

export function request(url, method = 'GET', data = {}, header = {}, body={}) {
	let userInfo = uni.getStorageSync('userInfo');
	let token = uni.getStorageSync('token');
	// let token = userInfo.token || null
	return new Promise((resolve, reject) => {
    uni.request({
      url: baseUrl + url,
      method,
      data,
      header:{
		  'token':token
	  },
      success: (res) => {
        resolve(res);
      },
      fail: (err) => {
		  console.log(err)
        reject(err);
      }
    });
  });
}

